{% extends 'base.html' %}
{%block top_nav%}
    <cla id="M_fontcolor">
        <span class="divider">/</span>
        <li class="active">文件管理</li>
    </cla>
{%endblock%}
{% block body %}
<class id="M_fontcolor">
    <div class="row">
        <div class="span10">
            <div class="tabbable"> <!-- Only required for left/right tabs -->
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#tab1" data-toggle="tab">{{ type1.fTypename }}</a></li>
                    <li><a href="#tab2" data-toggle="tab">{{ type2.fTypename }}</a></li>
                    <li><a href="#tab3" data-toggle="tab">{{ type3.fTypename }}</a></li>
                    <li><a href="#tab4" data-toggle="tab">{{ type4.fTypename }}</a></li>
                    <li><a href="#tab5" data-toggle="tab">{{ type5.fTypename }}</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="tab1">
                        <ul style="list-style: none">
                            <form action="/modfile/delall/" method="post">
                                <input type="checkbox" id="allcheck1">全选
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="checkbox" id="recheck1">反选
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="submit" value="批量删除" class="btn-warning">
                                <hr>
                                {% for file in files1 %}
                                <li>
                                    <div class="row">
                                        <div class="span3">
                                            <input type="checkbox" name="M_check1" value="{{ file.id }}">
                                            文件名：{{ file.fileName }}
                                        </div>
                                        <div class="span2">
                                            上传日期：{{ file.loadDate }}
                                        </div>
                                        <div class="span2">
                                            更改日期：{{ file.changeDate }}
                                        </div>
                                        <div class="span2">
                                            <div class="btn-group">
                                                <button class="btn-warning" onclick="del({{ file.id }})" type="button">删除</button>
                                                <button class="btn-primary" onclick="func({{ file.id }})" type="button">管理</button>
                                            </div>
                                        </div>
                                    </div>
                                    <hr>
                                </li>
                                {% endfor %}
                           </form>
                        </ul>
                    </div>
                    <div class="tab-pane" id="tab2">
                        <ul style="list-style: none">
                            <form action="/modfile/delall/" method="post">
                                <input type="checkbox" id="allcheck2">全选
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="checkbox" id="recheck2">反选
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="submit" value="批量删除" class="btn-warning">
                                <hr>
                                {% for file in files2 %}
                                <li>
                                    <div class="row">
                                        <div class="span3">
                                            <input type="checkbox" name="M_check2" value="{{ file.id }}">
                                            文件名：{{ file.fileName }}
                                        </div>
                                        <div class="span2">
                                           上传日期：{{ file.loadDate }}
                                        </div>
                                        <div class="span2">
                                            更改日期：{{ file.changeDate }}
                                        </div>
                                        <div class="span2">
                                            <div class="btn-group">
                                                <button class="btn-warning" onclick="del({{ file.id }})" type="button">删除</button>
                                                <button class="btn-primary" onclick="func({{ file.id }})" type="button">管理</button>
                                            </div>
                                        </div>
                                    </div>
                                    <hr>
                                </li>
                                {% endfor %}
                            </form>
                        </ul>
                    </div>
                    <div class="tab-pane" id="tab3">
                        <ul style="list-style: none">
                            <form action="/modfile/delall/" method="post">
                            <input type="checkbox" id="allcheck3">全选
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="checkbox" id="recheck3">反选
                            &nbsp;&nbsp;&nbsp;&nbsp;

                                <input type="submit" value="批量删除" class="btn-warning">
                            <hr>
                            {% for file in files3 %}
                            <li>
                                <div class="row">
                                    <div class="span3">
                                        <input type="checkbox" name="M_check3" value="{{ file.id }}">
                                        文件名：{{ file.fileName }}
                                    </div>
                                    <div class="span2">
                                        上传日期：{{ file.loadDate }}
                                    </div>
                                    <div class="span2">
                                        更改日期：{{ file.changeDate }}
                                    </div>
                                    <div class="span2">
                                        <div class="btn-group">
                                            <button class="btn-warning" onclick="del({{ file.id }})" type="button">删除</button>
                                            <button class="btn-primary" onclick="func({{ file.id }})" type="button">管理</button>
                                        </div>
                                    </div>
                                </div>
                                <hr>
                            </li>
                            {% endfor %}
                            </form>
                        </ul>
                    </div>
                    <div class="tab-pane" id="tab4">
                        <ul style="list-style: none">
                            <form action="/modfile/delall/" method="post">
                            <input type="checkbox" id="allcheck4">全选
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="checkbox" id="recheck4">反选
                            &nbsp;&nbsp;&nbsp;&nbsp;

                                <input type="submit" value="批量删除" class="btn-warning" onclick="delall()">
                            <hr>
                            {% for file in files4 %}
                            <li>
                                <div class="row">
                                    <div class="span3">
                                        <input type="checkbox" name="M_check4" value="{{ file.id }}">
                                        文件名：{{ file.fileName }}
                                    </div>
                                    <div class="span2">
                                        上传日期：{{ file.loadDate }}
                                    </div>
                                    <div class="span2">
                                        更改日期：{{ file.changeDate }}
                                    </div>
                                    <div class="span2">
                                        <div class="btn-group">
                                            <button class="btn-warning" onclick="del({{ file.id }})" type="button">删除</button>
                                            <button class="btn-primary" onclick="func({{ file.id }})" type="button">管理</button>
                                        </div>
                                    </div>
                                </div>
                                <hr>
                            </li>
                            {% endfor %}
                            </form>
                        </ul>
                    </div>
                    <div class="tab-pane" id="tab5">
                        <ul style="list-style: none">
                            <form action="/modfile/delall/" method="post">
                            <input type="checkbox" id="allcheck5">全选
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="checkbox" id="recheck5">反选
                            &nbsp;&nbsp;&nbsp;&nbsp;

                                <input type="submit" value="批量删除" class="btn-warning">
                            <hr>
                            {% for file in files5 %}
                            <li>
                                <div class="row">
                                    <div class="span3">
                                        <input type="checkbox" name="M_check5" value="{{ file.id }}">
                                        文件名：{{ file.fileName }}
                                    </div>
                                    <div class="span2">
                                        上传日期：{{ file.loadDate }}
                                    </div>
                                    <div class="span2">
                                        更改日期：{{ file.changeDate }}
                                    </div>
                                    <div class="span2">
                                        <div class="btn-group">
                                            <button class="btn-warning" onclick="del({{ file.id }})" type="button">删除</button>
                                            <button class="btn-primary" onclick="func({{ file.id }})" type="button">管理</button>
                                        </div>
                                    </div>
                                </div>
                                <hr>
                            </li>
                            {% endfor %}
                            </form>
                        </ul>

                    </div>
                </div>
            </div>
        </div>
    </div>
</class>
<script>
    function func(fileid) {
        window.location.href = '/modfile/tomanager/' + fileid;
    }
    function del(fileid) {
        if (confirm('是否删除此文件？')) {
            window.location.href = '/modfile/delfile/' + fileid;
        }
    }
    var all1=document.getElementById("allcheck1");
    var check1 = document.getElementsByName('M_check1')
    s1 = false
    all1.onclick = function () {
        s1 = !s1;
        if(s1){
            for(let i=0;i<check1.length;i++){
                check1[i].checked = true;
            }
        }
        else {
            for (let j=0;j<check1.length;j++){
                check1[j].checked = false;
            }
        }
    }
    var re1 = document.getElementById('recheck1');
    sign1 = false
    re1.onclick = function () {
        sign1 = !sign1
        if(sign1){
            for(let i=0;i<check1.length;i++){
                check1[i].checked = !check1[i].checked;
            }
        }
    }

    var all2=document.getElementById("allcheck2");
    var check2 = document.getElementsByName('M_check2')
    s2 = false
    all2.onclick = function () {
        s2 = !s2;
        if(s2){
            for(let i=0;i<check2.length;i++){
                check2[i].checked = true;
            }
        }
        else {
            for (let j=0;j<check2.length;j++){
                check2[j].checked = false;
            }
        }
    }
    var re2 = document.getElementById('recheck2');
    sign2 = false
    re2.onclick = function () {
        sign2 = !sign2
        if(sign2){
            for(let i=0;i<check2.length;i++){
                check2[i].checked = !check2[i].checked;
            }
        }
    }

    var all3=document.getElementById("allcheck3");
    var check3 = document.getElementsByName('M_check3')
    s3 = false
    all3.onclick = function () {
        s3 = !s3;
        if(s3){
            for(let i=0;i<check3.length;i++){
                check3[i].checked = true;
            }
        }
        else {
            for (let j=0;j<check3.length;j++){
                check3[j].checked = false;
            }
        }
    }
    var re3 = document.getElementById('recheck3');
    sign3 = false
    re3.onclick = function () {
        sign3 = !sign3
        if(sign3){
            for(let i=0;i<check3.length;i++){
                check3[i].checked = !check3[i].checked;
            }
        }
    }

    var all4=document.getElementById("allcheck4");
    var check4 = document.getElementsByName('M_check4')
    s4 = false
    all4.onclick = function () {
        s4 = !s4;
        if(s4){
            for(let i=0;i<check4.length;i++){
                check4[i].checked = true;
            }
        }
        else {
            for (let j=0;j<check4.length;j++){
                check4[j].checked = false;
            }
        }
    }
    var re4 = document.getElementById('recheck4');
    sign4 = false
    re4.onclick = function () {
        sign4 = !sign4
        if(sign4){
            for(let i=0;i<check4.length;i++){
                check4[i].checked = !check4[i].checked;
            }
        }
    }

    var all5=document.getElementById("allcheck5");
    var check5 = document.getElementsByName('M_check5')
    s5 = false
    all5.onclick = function () {
        s5 = !s5;
        if(s5){
            for(let i=0;i<check5.length;i++){
                check5[i].checked = true;
            }
        }
        else {
            for (let j=0;j<check5.length;j++){
                check5[j].checked = false;
            }
        }
    }
    var re5 = document.getElementById('recheck5');
    sign5 = false
    re5.onclick = function () {
        sign5 = !sign5
        if(sign5){
            for(let i=0;i<check5.length;i++){
                check5[i].checked = !check5[i].checked;
            }
        }
    }
    function delall() {
        confirm('确认删除？')
    }
</script>
{% endblock %}
